<template>
	<view class="invite">
		<apply-popup :group-code="groupCode" ref="applyPopupRef" @reload="init" />
	</view>
</template>
<script setup>
	import { nextTick, ref, defineComponent } from 'vue';
	import applyPopup from './components/apply-popup.vue';
	import { onLoad } from '@dcloudio/uni-app';
	const groupCode = ref('');
	const applyPopupRef = ref(null);
	defineComponent({ applyPopup });
	onLoad((options) => {
		if (options.id) groupCode.value = options.id;
		nextTick(() => {
			applyPopupRef.value.open();
		})
	})

	function init() {
		uni.$uv.route({
			url: '/group',
			params: {
				id: groupCode.value
			},
			type: 'redirectTo'
		})
	}
</script>